
import axios from 'axios';

/**
 * 订单
 */
export class OrderService {
    // 分页查询列表
    static findOrders (queryParams) {
        return axios({
            url: '/mall/Order/Order/findOrders',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的订单
    static findOrder (orderId) {
        const query = {
            orderId
        }
        return axios({
            url: '/mall/Order/Order/findOrder',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的订单(包含外键名称)
    static findOrderForView (orderId) {
        const query = {
            orderId
        }
        return axios({
            url: '/mall/Order/Order/findOrderForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的订单(包含外键名称)
    static findOrderForEdit (orderId) {
        const query = {
            orderId
        }
        return axios({
            url: '/mall/Order/Order/findOrderForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的订单(只提取ID 和 Name)
    static findOrdersWithIdNameById (orderId) {
        const query = {
            orderId
        }
        return axios({
            url: '/mall/Order/Order/findOrdersWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询订单集合(只提取ID 和 Name)
    static findOrdersWithIdNameByName (orderName) {
        const query = {
            orderName
        }
        return axios({
            url: '/mall/Order/Order/findOrdersWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存订单
    static saveOrder (order) {
        const query = {}
        return axios({
            url: '/mall/Order/Order/saveOrder',
            method: 'POST',
            params: query,
            data: order
        });
    }

    //修改保存订单
    static updateOrder (order) {
        const query = {}
        return axios({
            url: '/mall/Order/Order/updateOrder',
            method: 'POST',
            params: query,
            data: order
        });
    }

    //根据ID查询指定的订单(只提取ID 和 Name)
    static deleteOrder (orderId) {
        const query = {
            orderId
        }
        return axios({
            url: '/mall/Order/Order/deleteOrder',
            method: 'POST',
            params: query,
        });
    }

  static updateOrderStatus(orderId,status) {
    const query = {
      orderId,
      status
    }
    return axios({
      url: '/mall/Order/Order/updateOrderStatus',
      method: 'POST',
      params: query,
    });
  }
  static delivery(orderId) {
    const query = {
      orderId
    }
    return axios({
      url: '/mall/Order/Order/delivery',
      method: 'POST',
      params:query
    });
  }
}
